package cn.regexp.web.controller;

import cn.hutool.core.util.ObjectUtil;
import cn.regexp.domain.ShopFeedback;
import cn.regexp.service.IFeedbackService;
import cn.regexp.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("feedback")
public class FeedbackController {
    @Autowired
    private IFeedbackService feedbackService;

    @PostMapping("/feedback")
    public JsonResult<List<ShopFeedback>> queryFeedback(@RequestBody ShopFeedback feedback) {
        if (ObjectUtil.isNotEmpty(feedback)) {
            feedbackService.save(feedback);
        }
        return  JsonResult.success();
    }

}
